<%@ page contentType="text/html;charset=UTF-8" language="java" %>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>tree</title>
</head>
<body>
<canvas id="mycanvas" width="640px" height="480px"></canvas>
</body>


<button onclick="c()">测试连接</button>

<script src="//cdn.staticfile.org/stomp.js/2.3.3/stomp.min.js"></script>
<script src="//cdn.staticfile.org/sockjs-client/1.3.0/sockjs.min.js"></script>

<script>

    function c() {

        let socket = new SockJS('/message');
        let client = Stomp.over(socket);
        //  alert("发起连接")

        client.debug(function (str) {
            // alert(str)
        });

        client.connect({}, function () {

        }, function () {

            alert('出错')

        });

    }
</script>

</html>